<%@ taglib uri="http://jakarta.apache.org/struts/tags-html" prefix="html" %>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-bean" prefix="bean" %>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-logic" prefix="logic" %>

<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<html:html>
<head>	
	<link rel="stylesheet" type="text/css" href="<%= request.getContextPath() %>/css/sampleForm.css" />
	<link rel="stylesheet" type="text/css" href="<%= request.getContextPath() %>/css/me.css" />	
	<link rel="stylesheet" type="text/css" href="<%= request.getContextPath() %>/common/css/help/help.css" />
	<title>Pack</title>
 
	<script type='text/javascript' src='<%= request.getContextPath() %>/css/autocomplete/lib/jquery.js' ></script>
 
		
	<link rel="stylesheet" type="text/css" href="<%= request.getContextPath() %>/css/autocomplete/css/mainOLD.css" />
	<link rel="stylesheet" type="text/css" href="<%= request.getContextPath() %>/css/autocomplete/css/jquery.autocomplete.css" />
	<link rel="stylesheet" type="text/css" href="<%= request.getContextPath() %>/css/autocomplete/css/thickbox.css" />
 
  	<script type="text/javascript">
		$(document).ready(function(){

			$("#form1").submit(function(){
				var i=0;
				var pack = parseFloat($("#pack").val());				
				var min  = parseFloat($("#min").val());
				var max  = parseFloat($("#max").val());

				if(min>max) {	
					i++;	
					$('#max_error').text("*");
				}

				if(i>0) {
					return false;
				}else {
					return true;
				}			});
			
	 		$('td.number input').keypress(function(event){	checkForNumber(event,$(this).val());	});
	 		$('td.number input').blur(function(event){	
		 		var num = parseFloat($(this).val());
		 		num = isNaN(num)? 0:num;		 		
		 		$(this).val(num.toFixed(2));	
		 	});			
		});
		
		function checkForNumber(event, val) {
			if(event.which && ( event.which<48 || event.which>57) ) {
					if(event.which!=46 ) {
						event.preventDefault();
		 	  		}else {
		 				var a = val;
		 	  			for(var i=0; i<a.length;i++) {
		  	  			digit = a.charAt(i);
		  	  			if(digit==".") {        			  	  			
			  	  			event.preventDefault();
			  	  		}
		  	  		}
		  	  	}        	  	  		  	  		
		  	}
		}		
	</script>

<style type="text/css">
#form1 label.error, #max_error {
	font-size: 1.5em;
	color: red;
}
</style>

</head>

<body><br />
<b id='docNew'></b>
<b id='docOld'></b>
<div id="wrapper">
	<!-- 
		<div id="header"><img src="images/kiuchilogo.png" width="305" height="80" /></div>
	 -->	 
	<div id="menu"><ul id="nav"></ul></div>

	<div id="content">
		<div id="menuNav"><a href='<%=request.getContextPath() %>/Login.do?mode=check'>หน้าหลัก</a> 
		 
			<br /><br />
	<div style="background: #ffffff;">
	<p align="center" id="titleIssueType">Pack</p>
	<html:form action="/stock.do" styleId="form1"  >	 
	       <input type="hidden" name="mode" value="updatepack" />
	<div id="userPw01">
	<fieldset>
		<legend><b>pack</b></legend>
 		   <table border="1" >
			<tr>
				<td width="100"> code </td>
				<td>:</td>
				<td>${v.itemCode}
					<input type="hidden" name="itemCode" value="${v.itemCode}" id="itemCode" >
				</td>
				<td >
					
				</td>				
			</tr>
			<tr>
				<td>name</td>
				<td>:</td>
				<td width="400">${v.itemName }</td>
				<td ></td>					
			</tr>	
			<tr>
				<td >code ภายใน</td>
				<td>:</td>
				<td  >
					<input type="text" name="barcode" value="${v.barcode}" id="barcode" >
				</td>
				<td >
				</td>		
			</tr>	
			<tr>
				<td >ชื่อ ภายใน</td>
				<td>:</td>
				<td  >
					<input type="text" name="barcodeName" value="${v.barcodeName}" id="barcodeName" >
				</td>
				<td >
				</td>		
			</tr>								
			<tr>
				<td >pack</td>
				<td>:</td>
				<td class="number">
					<input type="text" name="packSize" value="${v.packSize }" id="pack" >
				</td>
				<td >
				</td>		
			</tr>			 					
			<tr>
				<td >min</td>
				<td>:</td>
				<td class="number">
					<input type="text" name="stockMin" value="${v.stockMin }" id="min">
				</td>
				<td >
				</td>		
			</tr>
			<tr>
				<td >max</td>
				<td>:</td>
				<td class="number">
					<input type="text" name="stockMax" value="${v.stockMax}" id="max">
				</td>
				<td ><span id="max_error"></span>
				</td>		
			</tr>				 			
 			 			 			 				 							
		</table>
		</center>
     </fieldset></div>
 	
 	<table border="0" align="center" width="100%">
 		<tr>
 			<td align="center" ><html:submit property="mode" value="update" onclick="return confirm('ยืนยันการบันทึกข้อมูล?');"  /></td>
 			<td align="center" ><html:reset></html:reset> </td>
			<td align="center" >
</td> 			
 		</tr>
 	</table>    	    	    	
    </html:form>	
	</div>
	</div>
	</div> 
</body>

</html:html>